<?php

namespace app\validate\admin;

use think\Validate;

class AdminValidate extends Validate
{
    public $rule = [
        'id' => 'require',
        'account' => 'require|unique:admin',
        'password' => 'require|length:6,10',
        'role_id' => 'require',
        'status' => 'require',
        'mobile' => 'require|mobile|unique:admin',
    ];

    public $message = [
        'id.require' => '记录id不能为空',
        'account.require' => '账号不能为空',
        'account.unique' => '账号名称已存在',
        'password.require' => '用户密码不能为空',
        'password.length' => '密码长度在4~10个字符之间',
        'role_id.require' => '请选择账户所属角色组',
        'status.require' => '请选择账户状态',
        'mobile.require' => '用户手机号不能为空',
        'mobile.unique' => '该手机号已存，请重新输入',
        'mobile.mobile' => '手机号格式错误',
    ];

    public $scene = [
        'add' => ['account', 'password', 'status', 'mobile'],
        'update' => ['id', 'account', 'status', 'mobile'],
    ];
}